import {AppConfig} from '@/types/config';
import {appDefaultConfig} from '@/config/appConfig';
import {defineStore} from 'pinia';

let state: AppConfig = {...appDefaultConfig};

export const useAppConfigStore = defineStore({
    id: 'appConfig',
    state: (): AppConfig => ({
        // 读取config下的默认配置
        ...state,
    }),
    getters: {
        getWebName(state: AppConfig) {
            return state.title
        },
        getWebConfigData(state: AppConfig) {
            return state
        },
        getLoginTypeList(state: AppConfig){
            return state.loginTypeList
        },
        getLoginPriority(state: AppConfig){
            return state.loginPriority
        }
    },
    actions: {
        setAppConfig(data: any) {
            this.$state = data
        },
    }
})
